package com.im.service.callback;

import com.alibaba.fastjson.JSON;
import com.im.common.model.RestResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "回调控制器")
@Slf4j
@RequestMapping
@RestController
public class CallbackController {

    @ApiOperation("回调机制测试接口")
    @RequestMapping(value = "/callback", method = RequestMethod.POST)
    public RestResponse callback(@RequestBody Object req, String command, Integer appId) {
        log.info("应用[{}]收到[{}]回调数据：{}", appId, command, JSON.toJSONString(req));
        return RestResponse.success();
    }
}
